package com.xiaoma.myaudience.biz.model;

import org.json.JSONException;
import org.json.JSONObject;

import android.os.Parcel;
import android.os.Parcelable;

public class CategoryVideoInfo extends BaseVideoInfo {
    
    public String mDigest = "";
    public String mLaunch = "";
    public String mPerformer = "";
    public String mPid = "";
    public String mDirector = "";
    public float mRating = 0f;
    public String mCategory = "";
    public String mType = "";
    
    @Override
    public void readFromJSONObject(JSONObject o) throws JSONException{
        super.readFromJSONObject(o);
        if (o != null) {
//        	if(o.has(CategorySearchItem.PARAM_DIGEST)) mDigest = o.getString(CategorySearchItem.PARAM_DIGEST);
//        	if(o.has(CategorySearchItem.PARAM_LAUNCH)) mLaunch = o.getString(CategorySearchItem.PARAM_LAUNCH);
//        	if(o.has(CategorySearchItem.PARAM_PERFORMER)) mPerformer = o.getString(CategorySearchItem.PARAM_PERFORMER);
//        	if(o.has(CategorySearchItem.PARAM_PID)) mPid = o.getString(CategorySearchItem.PARAM_PID);
//        	if(o.has(CategorySearchItem.PARAM_DIRECTOR)) mDirector = o.getString(CategorySearchItem.PARAM_DIRECTOR);
//        	if(o.has(CategorySearchItem.PARAM_RATING)) mRating = VideoStringUtils.getScore(o.getDouble(CategorySearchItem.PARAM_RATING));
//        	if(o.has(CategorySearchItem.PARAM_CATEGORY)) mCategory = o.getString(CategorySearchItem.PARAM_CATEGORY);
//        	if(o.has(CategorySearchItem.PARAM_TYPE)) mType = o.getString(CategorySearchItem.PARAM_TYPE);
        }
    }

    @Override
    public void writeToParcel(Parcel parcel, int paramInt) {
        super.writeToParcel(parcel, paramInt);
        parcel.writeString(mDigest);
        parcel.writeString(mLaunch);
        parcel.writeString(mPerformer);
        parcel.writeString(mPid);
        parcel.writeString(mDirector);
        parcel.writeFloat(mRating);
        parcel.writeString(mCategory);
        parcel.writeString(mType);
    }  
    
    @Override
    public void readFromParcel(Parcel source) {
        super.readFromParcel(source);
        mDigest = source.readString();
        mLaunch = source.readString();
        mPerformer = source.readString();
        mPid = source.readString();
        mDirector = source.readString();
        mRating = source.readFloat();
        mCategory = source.readString();
        mType = source.readString();
    }

    public static final Parcelable.Creator<CategoryVideoInfo> CREATOR = new Creator<CategoryVideoInfo>() {
        public CategoryVideoInfo createFromParcel(Parcel source) {
        	CategoryVideoInfo info = new CategoryVideoInfo();
            info.readFromParcel(source);
            return info;
        }

        public CategoryVideoInfo[] newArray(int size) {
            return new CategoryVideoInfo[size];
        }
    };
    
}
